var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("fsm"),
    i = t("Util"),
    s = t("ConfS"),
    c = t("fightManager"),
    l = t("fun"),
    u = t("Load"),
    p = t("AIdelay"),
    f = t("body"),
    d = cc._decorator,
    h = d.ccclass,
    y =
        (d.property,
        (function (t) {
            function e() {
                return (null !== t && t.apply(this, arguments)) || this;
            }
            return (
                n(e, t),
                (e.prototype.onEnable = function () {
                    if (c.default.ispvp) {
                        (this.data = this.adata.data), (this.pars = {a: 0, h: 0, d: 0});
                        var t = this.adata.herolvs[this.data.ID];
                        (this.infodata = l.getHeroPars(this.data.ID, t)),
                            (this.c = new l.c分数和状态()),
                            (this.c.name = this.adata.name),
                            c.default.inst.所有人的分数和状态.value.push(this.c);
                    } else
                        (this.data = s.DatasManager.HeroDatasById[this.infodata.characterId]),
                            (this.pars = {a: 0, h: 0, d: 0});
                    (this.maxhp.value = this.infodata.hp),
                        (this.hp.value = this.infodata.hp),
                        (this.maxmp.value = 100),
                        (this.mp.value = 0);
                    var e = this.node.getChildByName("sk").getComponent(sp.Skeleton);
                    (e.skeletonData = u.default.skeletonDatas[this.data.spinePath]),
                        c.default.ispvp
                            ? l.showEquips(e, this.data, this.adata.equips)
                            : l.showEquips(e, this.data, this.infodata.zhuangbeis ? this.infodata.zhuangbeis : []);
                    var o = c.default.inst.get_random_birth_point();
                    (this.node.x = o[0]), (this.node.y = o[1]);
                    var n = this.node.getComponent(cc.PhysicsBoxCollider);
                    (n.size = cc.size(this.data.zishen[0], this.data.zishen[1])),
                        n.apply(),
                        (this.node.getComponent(cc.BoxCollider).size = cc.size(
                            this.data.zishenhit[0],
                            this.data.zishenhit[1]
                        )),
                        a.changeState(this, p.default);
                }),
                (e.prototype.is_player = function () {
                    return !1;
                }),
                (e.prototype.get_all_enemys = function () {
                    var t = [];
                    if (c.default.ispvp) (t = c.default.inst.enemy.clone()), i.removeArray(t, this);
                    else {
                        var e = c.default.inst.helpPlayer;
                        e && e.isValid && e.enabled && t.push(e);
                    }
                    return c.default.inst.player.hp.value > 0 && t.push(c.default.inst.player), t;
                }),
                (e.prototype.get_buff_data = function (t, e) {
                    if (c.default.ispvp) {
                        null == (n = this.adata.skilllvs[t]) && (n = 1);
                        var o = 100 * (t - 101e6) + n + 1e8;
                        return s.DatasManager.BuffDatasById[o];
                    }
                    var n = this.infodata.SkillLv;
                    e && (n = 1);
                    o = 100 * (t - 101e6) + n + 1e8;
                    return s.DatasManager.BuffDatasById[o];
                }),
                (e.prototype.update = function (t) {
                    this.state.onUpdate(t);
                }),
                (e = r([h], e))
            );
        })(f.default));
o.default = y;
